<?php /* Template Name: Partneri VTP */ ?>
<?php
get_header();
?>

<?php

// ak nie su nastavene parametre v GET, nastavia sa docasne v POST
if (!isset($_GET['category1'])) {
    $_GET['category1'] = 13;
}

// prida odkazu class="current"
function isCurrent($number, $cat) {
    if ($cat == 1) 
        if ($_GET['category1'] == $number) return 'class="current"';
    return '';
}
?>

<div id="categoryMenu">
    <ul class="categoryMenu-1">
    <?php
        $page = '?page_id='.$_GET['page_id'];
        $cat2 .= '&category2='.$_GET['category2'];
        echo '<li><a href="'.$page.'&category1=13" '.isCurrent(13, 1).'>Lokálni</a></li>';
        echo '<li><a href="'.$page.'&category1=14" '.isCurrent(14, 1).'>Národní</a></li>';
        echo '<li><a href="'.$page.'&category1=15" '.isCurrent(15, 1).'>Medzinárodní</a></li>';
    ?>
    </ul>
</div>
<div class="clearer"></div>
<h2>Partneri</h2>
<hr class="h2hr" /><div class="clearer"></div>
<?php
$partners = $vtpPartners->getPartners($_GET['category1']);          

foreach ($partners as $partner) {
    echo '<div class="partner-item">';
    echo '<div class="partner-item-logo">';
    jr_post_image($partner->post_id);
    echo '</div>';
    echo '<span class="partner-item-name"><a href="'.get_permalink($partner->post_id).'">'.$partner->name.'</a></span>';
    echo '<span class="partner-item-perex">'.substr($partner->activity, 0, 100).' ...</span>';
    echo '</div>';
}

get_footer();
?>